﻿using Kendo.Mvc.Extensions;
using Kendo.Mvc.UI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

using CallCenter.Data;
using CallCenter.Data.BizUtilities;
using System.Configuration;
using System.Data;
using CallCenter.Security;
using CallCenter.Data.Models;
using CallCenter.Data.Misc;

namespace CallCenter.Web.Controllers
{
    public class AddCompanyToContactsController : BaseController
    {
        // GET: AddCompanyToContacts
        public ActionResult Index()
        {
            return View();
        }

        public ActionResult AddCompanyToContacts()
        {
            AddCompanyToContactVM cmpy = new AddCompanyToContactVM();
            return View(cmpy);
        }
      
        [HttpPost]
        public JsonResult GetCompaniesofContact(AddCompanyToContactVM model , int id)
        {
            var scratchPads = this.Bridge.CompanyContactsUtility.GetContact(id);
            return Json(scratchPads, JsonRequestBehavior.AllowGet);
        }

        [HttpPost]
        public JsonResult CreateCompanyToContact(AddCompanyToContactVM model)
        {
           
            var returnMessage = this.Bridge.CompanyContactsUtility.InsertCompanyToContact(model);          
            return Json(returnMessage, JsonRequestBehavior.AllowGet);          
        }

        [HttpPost]
        public JsonResult UpdateCompanyToContact(AddCompanyToContactVM model)
        {
           
            var returnMessage = this.Bridge.CompanyContactsUtility.UpdateCompanyToContact(model);           
            return Json(returnMessage, JsonRequestBehavior.AllowGet);          
        }

    }
}